const path = require('path')
function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  outputDir: 'dist',
  assetsDir: 'static',
  lintOnSave: false, //是否开启eslint
  productionSourceMap: false,
  publicPath: './',
  // pages: {
  //   diagnosticReport: {
  //     entry: './src/views/diagnosticReport/main.js',
  //     template: './src/views/diagnosticReport/index.html',
  //     filename: 'diagnosticReport.html',
  //     title: '诊断报告'
  //   },
  //   approvalDetails: {
  //     entry: './src/views/approvalDetails/main.js',
  //     template: './src/views/approvalDetails/index.html',
  //     filename: 'approvalDetails.html',
  //     title: '审批详情'
  //   },
  // },
  /*开发相关*/
  devServer: {
    port: 8082,
    host: '0.0.0.0',
    proxy: {
      // 配置跨域
      '/': {
        target: 'http://test-kxc.ruixiude.com:20076/sih-api', // 云平台测试环境
        ws: false,
        changeOrigin: true,
        // pathRewrite: {
        //   '^/api': ''
        // }
      }
    },
  },

  /*别名路径相关*/
  configureWebpack: {
    name: "基础移动端架构",
    resolve: {
      alias: {
        '@': resolve('src')
      }
    }
  },
  chainWebpack(config) {
    // set svg-sprite-loader
    config.module
      .rule('svg')
      .exclude.add(resolve('src/icons'))
      .end()
    config.module
      .rule('icons')
      .test(/\.svg$/)
      .include.add(resolve('src/icons'))
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]'
      })
      .end()
  },
}
